#ifndef __ABSTRACT_FACTORY_H__
#define __ABSTRACT_FACTORY_H__
#include <iostream>
#include <string>
#include <memory>

class Button{
public:
    virtual void render() = 0;
};

class TextBox{
public:
    virtual void render() = 0;
};

class WindowsButton : public Button{
public:
    virtual void render(){
        std::cout << "rending button by windows style..." << std::endl;
    }
};

class WindowsTextBox : public TextBox{
public:
    virtual void render(){
        std::cout << "rending textbox by windows style..." << std::endl;
    }
};

class MacButton : public Button{
public:
    virtual void render(){
        std::cout << "rending button by mac style..." << std::endl;
    }
};

class MacTextBox : public TextBox{
public:
    virtual void render(){
        std::cout << "rending textbox by mac style..." << std::endl;
    }
};



class AbstractFactory{
public:
    virtual std::unique_ptr<Button> CreateButton() = 0;
    virtual std::unique_ptr<TextBox> CreateTextBox() = 0;
};

class WindowsUIFactory : public AbstractFactory{
public:
    virtual std::unique_ptr<Button>  CreateButton(){
        return std::make_unique<WindowsButton>();
    }

    virtual std::unique_ptr<TextBox> CreateTextBox(){
        return std::make_unique<WindowsTextBox>();
    }
};

class MacUIFactory : public AbstractFactory{
public:
    virtual std::unique_ptr<Button>  CreateButton(){
        return std::make_unique<MacButton>();
    }

    virtual std::unique_ptr<TextBox> CreateTextBox(){
        return std::make_unique<MacTextBox>();
    }
};


#endif